import 'package:flutter/material.dart';
import 'package:zchope_student/const.dart';

class PlayerPlay extends StatefulWidget {
  @override
  _PlayerPlayState createState() => _PlayerPlayState();
}

_setContent() {
  List<Widget> list = List();
  for (int i = 0; i < 1; i++) {
    list.add(Text(
      '暂无数据',
      style: TextStyle(color: Const.gold, fontSize: 16),
    ));
  }
  return list;
}

class _PlayerPlayState extends State<PlayerPlay> {
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 8),
      child: ListView(
        children: _setContent(),
      ),
    );
//    return ListView(
//          children: <Widget>[
//
//            Text('驾驶证与机动车管理（一）',style: TextStyle(fontSize: 16,color: Const.gold,fontWeight: FontWeight.w600),),
////            DiscuzItem(title: 'title',date: '22222',content: '内容',),
//
//            Text('驾驶许可',style: TextStyle(fontSize: 15,color: Const.gold),),
//            Text('准驾车型',style: TextStyle(fontSize: 14,color: Const.gold),),
//
//          ],
//    );
  }
}

class DiscuzItem extends StatelessWidget {
  final title;
  final date;
  final content;

  const DiscuzItem({Key key, this.title, this.date, this.content})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: <Widget>[
        Text(
          title,
          style: TextStyle(color: Const.gold, fontSize: 16),
        ),
        SizedBox(
          height: 5,
        ),
        Text(
          date,
          style: TextStyle(color: Const.grey, fontSize: 12),
        ),
        SizedBox(
          height: 10,
        ),
        Text(
          content,
          style: TextStyle(color: Const.gold, fontSize: 16),
        ),
        SizedBox(
          height: 10,
        ),
        Divider(
          height: 1,
          color: Const.grey,
        )
      ],
    );
  }
}

class CourseItem extends StatelessWidget {
  final courseBean;

  const CourseItem({Key key, this.courseBean}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: <Widget>[
        Text(
          courseBean.title,
          style: TextStyle(color: Const.gold, fontSize: 16),
        ),
        SizedBox(
          height: 10,
        ),
        Courses(
          dataList: courseBean.content,
        ),
        SizedBox(
          height: 5,
        ),
        Divider(
          height: 1,
          color: Const.grey,
        )
      ],
    );
  }
}

class Courses extends StatelessWidget {
  final dataList;

  const Courses({Key key, this.dataList}) : super(key: key);

  _setCourses() {
    List<Widget> datas = List();
    for (String course in dataList) {
      datas.add(
        Text(
          course,
          style: TextStyle(color: Const.gold, fontSize: 12),
        ),
      );
    }
    return dataList;
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: _setCourses(),
    );
  }
}
